package com.qingke.javatest;

import java.io.InputStream;
import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import com.qingke.javatest.mybatis2.dao2.UserMapper;
import com.qingke.javatest.mybatis2.pojo2.User;

public class App2 {
	public static void main(String[] args){
		String resource = "mybatis_conf.xml";
		InputStream is=null;
		is=App.class.getClassLoader().getResourceAsStream(resource);
		SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(is,"test2");
		SqlSession session = sessionFactory.openSession();
		
		UserMapper ium=session.getMapper(UserMapper.class);
		
		List<User> list=ium.getAllUsers();
		for(User user:list){
			System.out.println(user);
		}
//		User user=ium.selectByPrimaryKey(1);
//		System.out.println(user);
	}
}	
